NotEmptyCollection

@SinceKotoolsTypes(version = "1.3")
interface NotEmptyCollection<out E> : Collection<E>

Represents collections containing at least one element.

Parameters

E

The type of elements contained in this collection.

Functions

Link copied to clipboard
abstract operator fun contains(element: E): Boolean
Link copied to clipboard
abstract fun containsAll(elements: Collection<E>): Boolean
Link copied to clipboard
open fun forEach(p0: Consumer<in E>)
Link copied to clipboard
abstract infix operator fun get(index: Int): E
open infix operator fun get(index: PositiveInt): E
open infix operator fun get(index: StrictlyPositiveInt): E

Returns the element at the specified index in this collection, or throws an IndexOutOfBoundsException if the index is out of bounds.

Link copied to clipboard
open infix fun getOrNull(index: Int): E?
open infix fun getOrNull(index: PositiveInt): E?
open infix fun getOrNull(index: StrictlyPositiveInt): E?

Returns the element at the specified index in this collection, or returns null if the index is out of bounds.

Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
abstract operator override fun iterator(): Iterator<E>
Link copied to clipboard
open fun parallelStream(): Stream<E>
Link copied to clipboard
open override fun spliterator(): Spliterator<E>
Link copied to clipboard
open fun stream(): Stream<E>
Link copied to clipboard
open fun <T : Any> toArray(p0: IntFunction<Array<T>>): Array<T>
Link copied to clipboard

Returns the string representation of this collection as a not blank string.

Properties

Link copied to clipboard
abstract val head: E

First element of this collection.

Link copied to clipboard
open override val size: Int
Link copied to clipboard

Returns the size of this collection as a strictly positive int.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: Int, defaultValue: (Int) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: PositiveInt, defaultValue: (PositiveInt) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: StrictlyPositiveInt, defaultValue: (StrictlyPositiveInt) -> @UnsafeVariance E): E

Returns the element at the specified index in this collection, or returns the result of calling the defaultValue function if the index is out of bounds.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyList(): NotEmptyList<E>

Returns a not empty list containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyListOrElse(defaultValue: (Collection<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a not empty list containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyListOrNull(): NotEmptyList<E>?

Returns a not empty list containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableList(): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableListOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableList<E>): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableListOrNull(): NotEmptyMutableList<E>?

Returns a not empty mutable list containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSet(): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableSetOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableSet<E>): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSetOrNull(): NotEmptyMutableSet<E>?

Returns a not empty mutable set containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySet(): NotEmptySet<E>

Returns a not empty set containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptySetOrElse(defaultValue: (Collection<E>) -> NotEmptySet<E>): NotEmptySet<E>

Returns a not empty set containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySetOrNull(): NotEmptySet<E>?

Returns a not empty set containing all the elements of this collection, or returns null if this collection is empty.